/**
 * 
 */
package com.huarui.notice.action;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.ewaf.framework.action.BaseAction;

import com.huarui.notice.INoticeService;
import com.opensymphony.xwork2.Action;

/**
 * @author sunpeng
 * 
 */
public class NoticeDealAction extends BaseAction {

	/**
	 * 
	 */

	private static final long serialVersionUID = 7935771043081075893L;
	private static final Logger logger = Logger
			.getLogger(NoticeDealAction.class);
	private Integer noticeId;
	private INoticeService noticeService;

	// public
	public String deal() {
		boolean result = false;
		logger.info("处理的消息ID号：" + this.noticeId);
		HashMap<String, Object> map = new HashMap<String, Object>();
		if (this.noticeId != null) {
			result = this.noticeService.deal(this.noticeId, true,
					super.parameters, map);
		}
		map.put("success", result);
		ServletActionContext.getContext().put("jsonResult", map);
		return Action.SUCCESS;

	}

	/**
	 * 取消处理消息
	 * 
	 * @return
	 */
	public String revert() {
		boolean result = false;
		HashMap<String, Object> map = new HashMap<String, Object>();
		if (this.noticeId != null) {
			result = this.noticeService.deal(this.noticeId, false,
					super.parameters, map);
		}

		map.put("success", result);
		ServletActionContext.getContext().put("jsonResult", map);
		return Action.SUCCESS;
	}

	public Integer getNoticeId() {
		return noticeId;
	}

	public void setNoticeId(Integer noticeId) {
		this.noticeId = noticeId;
	}

	public void setNoticeService(INoticeService noticeService) {
		this.noticeService = noticeService;
	}

}
